<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <input type="text" placeholder="请输入0~100之间的整数" :value="sum">
  <input type="button" value="猜一猜" @click="f()">
  <h1>结果:{{span}}</h1>
</div>
<script src="../js/vue.js"></script>
<script>
let x = parseInt(Math.random()*101);
let v = new Vue({
    el:"div",
    data:{sum:"",span:""},
   methods:{
        f:function () {
            if(v.sum>x){
                v.span="猜大了！"
            }else if(v.sum<x){
                v.span="猜小了！"
            }else{
                v.span="恭喜你猜对了！"
            }
        }
   }
})
</script>
</body>
</html>